<!DOCTYPE html>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<!--360浏览器优先以webkit内核解析-->
	<title>若依介绍</title>
	<link rel="shortcut icon" href="favicon.ico">
	<link href="../static/css/bootstrap.min.css" th:href="@{/css/bootstrap.min.css}" rel="stylesheet"/>
	<link href="../static/css/font-awesome.min.css" th:href="@{/css/font-awesome.min.css}" rel="stylesheet"/>
	<link href="../static/css/style.min.css" th:href="@{/css/style.min.css}" rel="stylesheet"/>
	<th:block th:include="include :: header('运单详情')" />
	<th:block th:include="include :: jsonview-css" />
</head>

<!--<body class="gray-bg">-->
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
	<div class="row">
		<form class="form-horizontal m" id="form-order-edit" th:object="${tudaOrder}">
			<div class="col-sm-4">
				<div class="ibox float-e-margins">
					<div class="ibox-title">
						<h5>订单信息</h5>
					</div>
					<div class="ibox-content">
						<input name="id" th:field="*{id}" type="hidden">
						<input name="orderType" th:field="*{orderType}" type="hidden">
						<input name="userId" th:field="*{userId}" class="form-control" type="hidden" required>
						<div class="form-group">
							<label class="col-sm-3 control-label">提验人：</label>
							<div class="col-sm-8">
								<input name="vehicleInspector" th:field="*{vehicleInspector}" class="form-control" type="text">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label is-required">业务员：</label>
							<div class="col-sm-8">
								<input name="userName" th:field="*{userName}" class="form-control" type="text">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label is-required">业务员手机号：</label>
							<div class="col-sm-8">
								<input name="salesmanPhone" th:field="*{salesmanPhone}" class="form-control" type="number" minlength="11" maxlength="11">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label is-required">车型：</label>
							<div class="col-sm-8">
								<input name="vehicleModel" th:field="*{vehicleModel}" class="form-control" type="text">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label is-required">车架号：</label>
							<div class="col-sm-8">
								<input name="vin" th:field="*{vin}" class="form-control" type="text">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label is-required">委托人：</label>
							<div class="col-sm-8">
								<input name="client" th:field="*{client}" class="form-control" type="text">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label is-required">委托人电话：</label>
							<div class="col-sm-8">
								<input name="clientPhone" th:field="*{clientPhone}" class="form-control" type="number" maxlength="11">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label is-required">起始地：</label>
							<div class="col-sm-8">
								<input name="origin" th:field="*{origin}" class="form-control" type="text">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label is-required">目的地：</label>
							<div class="col-sm-8">
								<input name="dest" th:field="*{dest}" class="form-control" type="text">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label is-required">接车人：</label>
							<div class="col-sm-8">
								<input name="receiver" th:field="*{receiver}" class="form-control" type="text">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label is-required">接车人电话：</label>
							<div class="col-sm-8">
								<input name="receiverPhone" th:field="*{receiverPhone}" class="form-control" type="number" maxlength="11">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label is-required">运费金额：</label>
							<div class="col-sm-8">
								<input name="freightAmount" th:field="*{freightAmount}" class="form-control" type="number">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">已付金额：</label>
							<div class="col-sm-8">
								<input name="paidAmount" th:field="*{paidAmount}" class="form-control" type="number">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">利润：</label>
							<div class="col-sm-8">
								<input name="profit" th:field="*{profit}" class="form-control" type="text">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">备注：</label>
							<div class="col-sm-8">
								<input name="notes" th:field="*{notes}" class="form-control" type="text">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">数据状态</label>
							<div class="col-sm-8">
								<div class="radio-box" th:each="dict : ${@dict.getType('is_delete')}">
									<input type="radio" th:id="${dict.dictCode}" name="isDelete" th:value="${dict.dictValue}" th:field="*{isDelete}" disabled="disabled">
									<label th:for="${dict.dictCode}" th:text="${dict.dictLabel}"></label>
								</div>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">支付类型</label>
							<div class="col-sm-8">
								<div class="radio-box" th:each="dict : ${@dict.getType('pay_type')}">
									<input type="radio" th:id="${dict.dictCode}" name="payType" th:value="${dict.dictValue}" th:field="*{payType}">
									<label th:for="${dict.dictCode}" th:text="${dict.dictLabel}"></label>
								</div>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">提验费(单位/元)：</label>
							<div class="col-sm-8">
								<input name="notes" th:field="*{inspectionFee}" class="form-control" style="width: 200px;" min="0" type="number">
							</div>
							<label class="col-sm-3 control-label">代驾费(单位/元)：</label>
							<div class="col-sm-8">
								<input name="notes" th:field="*{drivingFee}" class="form-control" style="width: 200px;" min="0" type="number">
							</div>
							<label class="col-sm-3 control-label">加油费(单位/元)：</label>
							<div class="col-sm-8">
								<input name="notes" th:field="*{refuelingFee}" class="form-control" style="width: 200px;" min="0" type="number">
							</div>
							<label class="col-sm-3 control-label">小板费(单位/元)：</label>
							<div class="col-sm-8">
								<input name="notes" th:field="*{smallBoardFee}" class="form-control" style="width: 200px;" min="0" type="number">
							</div>
							<label class="col-sm-3 control-label">叉车费(单位/元)：</label>
							<div class="col-sm-8">
								<input name="notes" th:field="*{forkliftFee}" class="form-control" style="width: 200px;" min="0" type="number">
							</div>
							<label class="col-sm-3 control-label">中介费(单位/元)：</label>
							<div class="col-sm-8">
								<input name="notes" th:field="*{agencyFee}" class="form-control" style="width: 200px;" min="0" type="number">
							</div>
							<label class="col-sm-3 control-label">其他(单位/元)：</label>
							<div class="col-sm-8">
								<input name="notes" th:field="*{otherFee}" class="form-control" style="width: 200px;" min="0" type="number">
							</div>
						</div>
					</div>
				</div>
			</div>
			<div class="col-sm-4">
				<div class="ibox float-e-margins">
					<div class="ibox-title">
						<h5>车辆信息</h5>
					</div>
					<div class="ibox-content">
						<div class="row">
							<div class="col-sm-12">
								<button type="button" class="btn btn-white btn-sm" onclick="addRow()"><i class="fa fa-plus"> 增加</i></button>
								<button type="button" class="btn btn-white btn-sm" onclick="sub.delRow()"><i class="fa fa-minus"> 删除</i></button>
								<div class="col-sm-12 select-table table-striped">
									<table id="bootstrap-table"></table>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
			<div class="col-sm-4">
			<div class="ibox float-e-margins">
				<div class="ibox-title">
					<h5>车辆图片</h5>
				</div>
				<div class="ibox-content">
					<div th:if="${tudaOrder.carImgList != null}" th:each="imgs,status: ${tudaOrder.carImgList}">
						<p id="pay-qrcode1">
							<a href="javascript:;">
								<img th:src="${imgs}" width="100%" alt="点击看大图">
							</a>
						</p>
					</div>
					<div th:if="${tudaOrder.contractImgList != null}" th:each="imgs,status: ${tudaOrder.contractImgList}">
						<a href="javascript:;">
							<img th:src="${imgs}" width="100%" alt="点击看大图">
						</a>
					</div>
				</div>
			</div>
		</div>
		</form>
	</div>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: jsonview-js" />
<th:block th:include="include :: bootstrap-table-custom-view-js" />
<script th:src="@{/js/jquery.min.js}"></script>
<script th:src="@{/js/bootstrap.min.js}"></script>
<script th:src="@{/ajax/libs/layer/layer.min.js}"></script>
<script type="text/javascript">
	var prefix = ctx + "system/order";
	$("#form-order-edit").validate({
		focusCleanup: true
	});

	function submitHandler() {
		if ($.validate.form()) {
			$.operate.save(prefix + "/edit", $('#form-order-edit').serialize());
		}
	}

	$(function() {
		var options = {
			data: [[${tudaOrder.tudaOrderTransferList}]],
			pagination: false,
			showSearch: false,
			showRefresh: false,
			showToggle: false,
			showColumns: false,
			sidePagination: "client",
			columns: [{
				checkbox: true
			},
				{
					field: 'index',
					align: 'center',
					title: "序号",
					formatter: function (value, row, index) {
						var columnIndex = $.common.sprintf("<input type='hidden' name='index' value='%s'>", $.table.serialNumber(index));
						return columnIndex + $.table.serialNumber(index);
					}
				},
				{
					field: 'name',
					align: 'center',
					title: '中转段',
					formatter: function(value, row, index) {
						var html = $.common.sprintf("<input class='form-control' type='text' name='tudaOrderTransferList[%s].name' value='%s' disabled>", index, value);
						return html;
					}
				},

				{
					field: 'transitBranch',
					align: 'center',
					title: '中转分公司',
					formatter: function(value, row, index) {
						var html = $.common.sprintf("<input class='form-control' type='text' name='tudaOrderTransferList[%s].transitBranch' value='%s' disabled>", index, value);
						return html;
					}
				},

				{
					field: 'headPhone',
					align: 'center',
					title: '分公司负责人',
					formatter: function(value, row, index) {
						var html = $.common.sprintf("<input class='form-control' type='text' name='tudaOrderTransferList[%s].headPhone' value='%s' disabled>", index, value);
						return html;
					}
				},
				{
					field: 'plateNumber',
					align: 'center',
					title: '车牌号',
					formatter: function(value, row, index) {
						var html = $.common.sprintf("<input class='form-control' type='text' name='tudaOrderTransferList[%s].plateNumber' value='%s' disabled>", index, value);
						return html;
					}
				},
				{
					field: 'transporter',
					align: 'center',
					title: '驾驶员',
					formatter: function(value, row, index) {
						var html = $.common.sprintf("<input class='form-control' type='text' name='tudaOrderTransferList[%s].transporter' value='%s' disabled>", index, value);
						return html;
					}
				},
				{
					field: 'transporterPhone',
					align: 'center',
					title: '驾驶员电话',
					formatter: function(value, row, index) {
						var html = $.common.sprintf("<input class='form-control' type='text' name='tudaOrderTransferList[%s].transporterPhone' value='%s' disabled>", index, value);
						return html;
					}
				},

				{
					field: 'amount',
					align: 'center',
					title: '到收费用',
					formatter: function(value, row, index) {
						var html = $.common.sprintf("<input class='form-control' type='text' name='tudaOrderTransferList[%s].amount' value='%s' disabled>", index, value);
						return html;
					}
				},

				{
					field: 'owes',
					align: 'center',
					title: '欠反',
					formatter: function(value, row, index) {
						var html = $.common.sprintf("<input class='form-control' type='text' name='tudaOrderTransferList[%s].owes' value='%s' disabled>", index, value);
						return html;
					}
				},

				{
					field: 'transferFee',
					align: 'center',
					title: '中转费',
					formatter: function(value, row, index) {
						var html = $.common.sprintf("<input class='form-control' type='text' name='tudaOrderTransferList[%s].transferFee' value='%s' disabled>", index, value);
						return html;
					}
				},
				{
					field: 'transitPoint',
					align: 'center',
					title: '中转地',
					formatter: function (value, row, index) {
						var html = $.common.sprintf("<input class='form-control' type='text' name='tudaOrderTransferList[%s].transitPoint' value='%s'>", index, value);
						return html;
					}
				},
				{
					field: 'state',
					align: 'center',
					title: '运输状态',
					formatter: function(value, row, index) {
						var html = $.common.sprintf("<input class='form-control' type='text' name='tudaOrderTransferList[%s].state' value='运输中' disabled>", index, value);
						if(value == 2){
							html = $.common.sprintf("<input class='form-control' type='text' name='tudaOrderTransferList[%s].state' value='已完成' disabled>", index, value);
						}return html;
					}
				},

				{
					field: 'notes',
					align: 'center',
					title: '备注',
					formatter: function(value, row, index) {
						var html = $.common.sprintf("<input class='form-control' type='text' name='tudaOrderTransferList[%s].notes' value='%s' disabled>", index, value);
						return html;
					}
				},
				{
					field: 'createTime',
					align: 'center',
					title: '创建时间',
					formatter: function(value, row, index) {
						var html = $.common.sprintf("<input class='form-control' type='text' name='tudaOrderTransferList[%s].createTime' value='%s' disabled>", index, value);
						return html;
					}
					// },
					//
					// {
					// 	title: '操作',
					// 	align: 'center',
					// 	formatter: function(value, row, index) {
					// 		var value = $.common.isNotEmpty(row.index) ? row.index : $.table.serialNumber(index);
					// 		return '<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="sub.delRowByIndex(\'' + value + '\')"><i class="fa fa-remove"></i>删除</a>';
					// 	}
				}]
		};
		$.table.init(options);
	});

	function addRow() {
		var count = $("#" + table.options.id).bootstrapTable('getData').length;
		var row = {
			index: $.table.serialNumber(count),
			name: "",
			transitBranch: "",
			headPhone: "",
			plateNumber: "",
			transporter: "",
			transporterPhone: "",
			amount: "",
			owes: "",
			transferFee: "",
			state: "",
			notes: "",
			createTime: "",
		}
		sub.addRow(row);
	}

	$('#pay-qrcode').click(function(){
		var html=$(this).html();
		parent.layer.open({
			title: false,
			type: 1,
			closeBtn:false,
			shadeClose:true,
			area: ['600px', '360px'],
			content: html
		});
	});
</script>
</body>
</html>
